package com.zr.subClass.mapper;

import com.zr.planClass.model.PlanClassAllVo;
import com.zr.planClass.model.PlanStutas;
import com.zr.subClass.model.PageSelectVo;
import com.zr.subClass.model.SubClassAllVo;
import com.zr.subClass.model.SubClassVo;
import com.zr.subClass.model.SubStutas;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * Created by 天赐 on 2019/12/20.
 */
@Mapper
public interface SubClassMapper {

    /*@Select("select count(id) from planclass where name=#{name}")
    public int queryByName(String name);

    @Select("select count(id) from planclass where code=#{code}")
    public int queryByCode(String code);

    @Insert("insert into planclass (code,name,status,remark,createName,createTime,updateName,updateTime)" +
            "values (#{code},#{name},#{status},#{remark},#{createName},#{createTime},#{updateName},#{updateTime})")
    void addPlanClass(PlanClassAllVo planClassAllVo);

    @Update("update planclass set name=#{name},remark=#{remark},updateTime=#{updateTime} where id=#{id}")
    void updatePlanClass(PlanClassAllVo planClassAllVo);

    */



    Integer getCount(PageSelectVo pageSelectVo);

    List<SubClassAllVo> getPage(PageSelectVo pageSelectVo);

    @Update("update subclass set status=#{status} where id=#{id}")
    void updateStudas(@Valid SubStutas subStutas);


    @Insert("insert into subclass (code,name,status,remark,createName,createTime,updateName,updateTime)" +
            "values (#{code},#{name},#{status},#{remark},#{createName},#{createTime},#{updateName},#{updateTime})")
    void addSubClass(SubClassAllVo subClassAllVo);

    @Select("select * from subclass where id=#{id}")
    SubClassAllVo queryById(Integer id);

    @Update("update subclass set name=#{name},remark=#{remark},updateTime=#{updateTime} where id=#{id}")
    void updateSubClass(SubClassVo subClassVo);

    @Select("select count(id) from subclass where name=#{name}")
    public int queryByName( String name);
}
